package _11FlyWeightDesign;

import java.util.HashMap;

public class TeacherFactory {
    private HashMap<String,Teacher> pool;
    public TeacherFactory(){
        pool=new HashMap<String, Teacher>();
    }
    public Teacher getTeacher(String number){
        Teacher teacher=pool.get(number);
        if (!pool.containsKey(number)){
                teacher=new Teacher("a","男",22,number);
                pool.put(number,teacher);
        }
        return teacher;
    }
}
